package javacommon.authority.controller;

import java.util.ArrayList;
import java.util.List;

import javacommon.authority.model.Menu;
import javacommon.authority.model.User;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;

import com.jfinal.core.Controller;
/**
 * 访问路径 /menu
 * @author zhengwei
 *
 */
public class MenuController extends Controller {
	/**
	 * 根据userId 查询能够看到的菜单,递归拼接层级结构
	 */
	public void leftMenu(){
		User user = getSessionAttr("user");
		if (user==null) {
			redirect("/");
		}else {
			List<Menu> listMenu=user.getMenuAndLeaf();
			setAttr("status", "success");
			setAttr("data", listMenu);
			renderJson();
		}
	}


}
